#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
	int n = 0;
	scanf("%d", &n);
	int p[10] = { 0 };
	int arr[10] = { 0 };
	int i = 0;
	for (i = 0; i < 7; i++)
	{
		scanf("%d", arr + i);
	}
	int N[10] = { 0 };

	for (i = 0; i < n; i++)
	{
		int count = 0;
		int j = 0;
		for (j = 0; j < 7; j++)
		{
			scanf("%d", N + j);
			int x = 0;
			for (x = 0; x < 7; x++)
			{
				if (N[j] == arr[x])
					count++;
			}
		}
		if (count == 7)
			p[0]++;
		else if (count == 6)
			p[1]++;
		else if (count == 5)
			p[2]++;
		else if (count == 4)
			p[3]++;
		else if (count == 3)
			p[4]++;
		else if (count == 2)
			p[5]++;
		else if (count == 1)
			p[6]++;
	}

	for (i = 0; i < 7; i++)
	{
		printf("%d ", p[i]);
	}
	return 0;
}
